<?php
namespace App\Events;

use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;

class QiniuFopEvent implements ShouldBroadcast
{
    use SerializesModels;

    public $key;
    public $data;

    /**
     * WechatLoginedEvent constructor.
     * @param $key
     * @param array $data
     */
    public function __construct($key,array $data)
    {
        $this->key = $key;
        $this->data = $data;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel($this->key);
    }

    public function broadcastAs()
    {
        return 'qiniu.fop';
    }


    public function broadcastWith()
    {
        return $this->data;
    }


}
